package progark.a9.javaserver;

import java.util.ArrayList;

public class Ship {
	private int slots;
	private ArrayList<String> coordinates;
	private ArrayList<String> shots;
	
	public Ship(){
		slots = 0;
		coordinates = new ArrayList<String>();
		shots = new ArrayList<String>();
	}

	public int getSlots() {
		return slots;
	}

	public void setSlots(int slots) {
		this.slots = slots;
	}
	
	public void setCoordinate(String coordinate){
		coordinates.add(coordinate);
	}
	
	public ArrayList<String> getCoordinates(){
		return coordinates;
	}
	
	public boolean checkShot(String coordinate){
		if(coordinates.contains(coordinate)){
			shots.add(coordinate);
			return true;
		}
		return false;
	}
	
	public boolean destroyedShip(){
		if(shots.size() == slots)
			return true;
		return false;
	}

}
